package com.test.thread;

import javax.swing.*;
import java.util.Vector;

public class VectoryDemo {
    //private Vector<String> vector;

    public Object getLast(Vector vector){
        int lastIndex= vector.size()-1;
        return vector.get(lastIndex);
    }

    public void deleteLast(Vector vector){
        int lastIndex=vector.size()-1;
        vector.remove(lastIndex);
    }

    public Object getLastSync(Vector vector){
        synchronized (vector){
            int lastIndex= vector.size()-1;
            return vector.get(lastIndex);
        }
    }
    public void deleteLastSync(Vector vector){
        synchronized (vector) {
            int lastIndex=vector.size()-1;
            vector.remove(lastIndex);
        }
    }
}
